#include "Comm.hpp"
#include "pipe.hpp"
int main()
{
    key_t key = Getkey();//获取key
    int shmid = ServerGetshm(key);//创建共享内存
    void *addr = Attach(shmid);//挂接
    int *address = (int *)addr;
    Fifo fifo;//创建管道
    int rfd = Serveropenfifo();//以读方式打开文件
    for (int i = 0; i < 10; i++)
    {
        wait(rfd);//写端不写，就阻塞在这里
        int *tmp = address;
        cout << "Server get ";
        while (*(tmp) != 0)
        {
            cout << *(tmp);
            tmp++;
        }
        cout << endl;
    }
    Detach(addr);//去挂接
    removeshm(shmid);//删除共享内存
    return 0;
}